//
// RTSPServerSession.h
//
// $Id: //base/include/RTSPServerSession.h
//
// Library: base
// Package: base
// Module : RTSPServerSession
// Author :	Jelin,doitsjz@163.com
// Date	  :	10/30/2012
// 
// Definition of the RTSPServerSession class.
//
// Copyright (c) 2012-2012, iGuard.
//


#ifndef Base_HTTPServerSession_INCLUDED
#define Base_HTTPServerSession_INCLUDED


/**
	RTSPServerSession class for recving RTSP Request 
	and sending RTSP Response
*/

#include "base.h"
#include "BaseHTTPSession.h"
using namespace std;

class BASE_API BaseHTTPServerSession: public BaseHTTPSession
{
public:
	BaseHTTPServerSession(){};
	~BaseHTTPServerSession(){};
protected:
	//subclass should implement this method by myself
//	int handleMessage(RTSPMessage* pMessage);
	virtual int handleMessage(BaseHTTPRequest& request);
	virtual int handleMessage(BaseHTTPResponse& reply);

protected:
	//deal with request from client,Server side,C->S
	//called by <handleMessage> but,implement by subclass
	//virtual void OnOptionsRequest(BaseHTTPRequest& request){};
	//virtual void OnHeadRequest(BaseHTTPRequest& request){};
	virtual void OnGetRequest(BaseHTTPRequest& request){};
	virtual void OnPostRequest(BaseHTTPRequest& request){};
	virtual void OnPutRequest(BaseHTTPRequest& request){};
	virtual void OnDeleteRequest(BaseHTTPRequest& request){};
	//virtual void OnTraceRequest(BaseHTTPRequest& request){};
	//virtual void OnConnectRequest(BaseHTTPRequest& request){};

public:
	int makeReply(int status,string &body,string& reply);
};

#endif